<div id="content">
	<div class="row s_page_title">
		<sa-big-breadcrumbs [items]="['日志信息管理','设备检测日志']" icon="fa fa-tag" class="col-xs-12 col-sm-7 col-md-7 col-lg-4"></sa-big-breadcrumbs>
	</div>
	<sa-widgets-grid>
		<div class="s_table">
			<div sa-widget [editbutton]="false" color="darken" class="clearfix">
				<header><span class="widget-icon"> <i class="fa fa-table"></i> </span><h2>设备检测日志</h2></header>
				<div>
					<div class="widget-body no-padding">
						<div class="page-header clearfix s_table_opreation">
							<div class="left page-header-btn" style="width: calc(100% - 230px);">
								<sa-company-tree-car companyTreeId="companyTree" wrapId="content" [isShowCarSort]="false" [isShowCarNum]="true" (companySelected)="companySelected($event)"></sa-company-tree-car>
								<div class="top_module top_module_box">
                                    <span class="top_module_label module_text">设备状态</span>
                                    <select name="" class="top_module_select" [(ngModel)]="deviceStatus">
                                        <option value="">全部</option>
                                        <option value="在线">在线</option>
                                        <option value="离线">离线</option>
                                        <option value="无上线记录">无上线记录</option>
                                    </select>
								</div>
								<div class="top_module top_module_box">
                                    <span class="top_module_label module_text">蓝牙状态</span>
                                    <select name="" class="top_module_select" [(ngModel)]="bluetoothStatus">
                                        <option value="">全部</option>
                                        <option value="已连接">已连接</option>
                                        <option value="未连接">未连接</option>
                                    </select>
								</div>
								<!-- select2的 -->
								<div class="top_module top_module_box">
									<span class="top_module_label module_text">硬件状态
									</span><select class="top_module_select select2" id="statusSelect2" name="carUseType" select2 >
										<option value="">全部</option>
										<optgroup *ngFor="let item of status" [label]="item.label">
											<option *ngFor="let lis of item.children" [value]='item.id'>{{lis.label}}</option>
										</optgroup>
									</select>
								</div>
								<div class="top_module top_module_box">
									<span class="module_text">操作人</span>
									<input type="text" class="module_inp top_module_select" [(ngModel)]="userName" placeholder="操作人"/>
								</div>
								<div class="selectDate top_module">
									<table-select-date [notInit]='true' [specifyTime]='specifyTime' [notInit]="true" (outerTime)="dateSelect($event)" ></table-select-date>
								</div>
								<div class="top_module">
									<span class="module_text">选择天数</span>
									<select name="" id="" class="module_inp"  [(ngModel)]="dateNumber" (change)='selectDate()'>
										<option value="0">请选择</option>
										<option value="10">近10天</option>
										<option value="20">近20天</option>
										<option value="30">近30天</option>
										<option value="60">近60天</option>
										<option value="90">近90天</option>
										<option value="100">近100天</option>
									</select>
								</div>
								<button class="btn btn-primary" (click)="tableSearch()">查询</button>
								<button type="button" class="btn btn-primary" (click)="exportData()">导出</button>
							</div>
							<div class="right top-search">
								<input type="text" [(ngModel)]="searchKey" (change)="tableSearch()" class="search-input" placeholder="公司名称/车牌号/设备ID/操作人">
								<span class="top-search-box">
							        <button class="top-search-btn" type="button" (click)="tableSearch()"> <i class="fa fa-search"></i></button>
							    </span>
							</div>
						</div>
						<div class="table_scroll">
							<table class="display dataTables responsive table table-striped table-bordered table-hover dataTable s_h5_table">
								<thead>
									<tr>
										<th>所属公司</th>
										<th>车牌号码</th>
										<th>设备ID</th>

										<th>设备状态</th>
										<th>硬件版本</th>
										<!-- 循环 -->
										<th>电压状态</th>
										<th>GPRS状态</th>
										<th>GPS状态</th>
										<th>采集器芯片</th>
										<th>传感器状态</th>

										<th>蓝牙状态</th>
										<th>软件版本</th>
										
										<th>创建时间</th>
										<th>操作人</th>
										<th>手机型号</th>
										<th>手机终端</th>
										<!-- <th  *ngIf="isShowDelete">操作</th> -->
									</tr>
								</thead>
								<tbody>
									<tr *ngFor="let row of tableData" >
										<td>{{row.companyName}}</td>
										<td>{{row.carNumber}}</td>
										<td>{{row.deviceId}}</td>
										
										<td>{{row.deviceStatus}}</td>
										<td>{{row.hardwareVersion}}</td>
										
										<!-- 循环开始 -->
										<td *ngFor="let device of row.deviceCheckInfo">
											<span *ngIf="device.index!=4">
												状态:<span [ngStyle]="{'color':device.status==0?'red':'#418f02','font-weight':'bold'}">{{device.status==0?'异常':'正常'}}</span>{{device.deviceCheckSubInfo.length>0?', ':''}}<span *ngFor="let info of device.deviceCheckSubInfo let i=index">{{info.title}}{{info.content}}{{i==device.deviceCheckSubInfo.length-1?"":", "}}</span>
											</span>
											<span *ngIf="device.index==4">
												状态:<span [ngStyle]="{'color':device.status==0?'red':'#418f02','font-weight':'bold'}">{{device.status==0?'异常':'正常'}}</span>{{device.deviceCheckSubInfo.length>0?', ':''}}<span *ngFor="let info of device.deviceCheckSubInfo let i=index">{{info.title}}<span *ngFor="let channel of info.content let channelIndex = index"><span *ngIf="channel==1" title="传感器正常" class="channel-style bg-green">{{channelIndex+1}}</span><span *ngIf="channel==0" title="传感器异常" class="channel-style bg-red">{{channelIndex+1}}</span></span></span>
											</span>
										</td>
										<td *ngIf="row.deviceCheckInfo.length < 5"></td>
										<td>{{row.bluetoothStatus}}</td>
										<td>{{row.currentVersion}}({{row.defaultVersion}})</td>

										<td>{{row.createTime}}</td>
										<td>{{row.userName}}</td>
										<td>{{row.phoneType}}</td>
										<td>{{row.terminal}}</td>
										<!-- <td  *ngIf="isShowDelete">
                                            <button type="button" (click)="deleteRow(row)">删除</button>
                                        </td> -->
									</tr>
								</tbody>
							</table>
						</div>
						<div class="table-fix clearfix">
							<paginator [totalRecords]="totalCount"
						           [rows]="pageSize"
						           [currentPage]="curPage - 1"
						           (onPageChange)="paginate($event)">
							</paginator>
							<button type="button" class="btn default refresh_btn" (click)="refresh()"><i class="fa fa-refresh"></i></button>
						</div>
					</div>
				</div>
			</div>
		</div>
	</sa-widgets-grid>
</div>